<template>
	<view class="content" style="padding-bottom: 150rpx;">
		<u-navbar title='查看帖子' back-icon-color='white' title-color='white' :is-back="true" :immersive="true"
			:background="{
			background: 'none'
		}" :border-bottom="false" />
		<u-swiper :list="info.images.split(',')" height='617' />
		<view class="title">
			<view class="title_1">{{info.title}}</view>
			<!-- to_('/pages/index/poster/poster') -->
			<view class="title_2" @click="show_(true)">
				<image src="https://puputong.huijipin.cn/uploads/20220324/d4d8a79ec193a7903616bb5ab37b7d23.png" />
				<text>转发</text>
			</view>
		</view>
		<view class="carp">
			<view class="carp_1">
				<view class="carp_1_1">
					<text>{{info.space}}</text>
					<text>㎡</text>
				</view>
				<view class="carp_1_2">
					面积
				</view>
			</view>
			<view class="carp_1">
				<view class="carp_1_1">
					<text>{{info.rent}}</text>
					<text>/月</text>
				</view>
				<view class="carp_1_2">
					租金
				</view>
			</view>
			<view class="carp_1">
				<view class="carp_1_1">
					<text>{{info.transfer_fee}}</text>
					<text>万</text>
				</view>
				<view class="carp_1_2">
					转让费
				</view>
			</view>
		</view>
		<view class="carp2">
			<view class="carp2_1">
				<view class="carp2_1_1">
					<text>区域：</text>
					<text>{{info.area}} </text>
				</view>
				<view class="carp2_1_1 huanhang2">
					<text>地址：</text>
					<text>{{info.detail_address}}</text>
				</view>
				<view class="carp2_1_1">
					<text>标签：</text>
					<text>{{info.industry}} </text>
				</view>
				<view class="carp2_1_1">
					<text>类别：</text>
					<text>{{info.type}} </text>
				</view>
			</view>
			<image class="img" v-if="info.is_success==1"
				src="https://puputong.huijipin.cn/uploads/20220324/ad82f84c375aff8c52e540ee488c0721.png" />
			<image class="img" v-else
				src="https://puputong.huijipin.cn/uploads/20220325/be5fa179f6b21f2619b524313dc05040.png" />

		</view>

		<u-gap height="15" bg-color="#F4F5F7 " />
		<view class="caep3">
			<text class="carp_1">
				店铺描述
			</text>
			<view style="margin-top: 30rpx;">
				<mp-html :content="info.content"></mp-html>
			</view>
		</view>
		<u-gap height="15" bg-color="#F4F5F7 " />
		<view class="caep3">
			<text class="carp_1">
				配套设备
			</text>
			<view class="carp_2_1">
				<view class="carp_3_1" v-for="(item,index) in list">
					<image :src="item.img" />
					<text>{{item.name}}</text>
				</view>

			</view>
		</view>
		<u-gap height="15" bg-color="#F4F5F7 " />
		<view class="caep3">
			<text class="carp_1" @click="map">
				地图
			</text>
			<view @click="map" style="margin-top: 30rpx;">
				<map show-location layer-style style="width: 100%; height: 244rpx;" scale='15' :latitude="latitude"
					:longitude="longitude" :markers="covers" />
			</view>
		</view>
		<view class="caep4_1">
			猜你喜欢
		</view>
		<cai-love></cai-love>
		<view class="foot">
			<view class="foot_1" @click="sc">
				<image v-if="!info.is_collect" src="https://puputong.huijipin.cn/uploads/20220325/915d9d17b102c51fd34e211bee6a4b6f.png" />
				<image v-else src="../../static/img/tsc.png" />
				<text>收藏</text>
			</view>
			<view class="foot_2" @click="phone">
				一键拨打
			</view>
		</view>
		<u-popup :mask="true" height='262' v-model="show" mode='bottom'>
			<view class="w">
				<view class="carpw">
					<view class="carp_1w">
						<view class="carp_1_1w" @click="fx(1)">
							<image src="@/static/img/wx1.png" />
							<button type="default" open-type="share" style="background-color: white;border: none;">
								<text>微信</text>
							</button>
						</view>
						<view class="carp_1_1w" @click="fx(3)">
							<image src="@/static/img/pyq.png" />
							<!-- <button type="default" open-type="share" style="background-color: white;border: none;"> -->
							<text>朋友圈</text>
							<!-- </button> -->
						</view>
						<view class="carp_1_1w" @click="fx(3)">
							<image style="width: 64rpx;height: 64rpx"
								src="https://puputong.huijipin.cn/uploads/20220325/4f0bb09610b3c4b5085e412c029d3fec.png" />
							<text>分享海报</text>
						</view>
					</view>
					<view class="qxw " @click="show_(false)">
						<text style="margin-right: 40rpx;">取消</text>
					</view>
				</view>
			</view>

		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: 0, // 使用 marker点击事件 需要填写id
				title: 'map',
				show: false,
				latitude: 34.75605,
				longitude: 113.642339,
				covers: [{
					latitude: 34.75605,
					longitude: 113.642339,
					iconPath: 'https://puputong.huijipin.cn/uploads/20220324/b98578a88a0c208bf59b8112a17fbd59.png'
				}],
				info: {},
				info_id: '',
				list: [{
						name: '客梯',
						img: "https://puputong.huijipin.cn/uploads/20220324/5eb8fe7bcebbf800761a4aa6ac705d95.png",
						type: 1
					},
					{
						name: '货梯',
						img: "https://puputong.huijipin.cn/uploads/20220324/a2a4e685e36ae795cf1afda409d46292.png",
						type: 2
					},
					{
						name: '中央空调',
						img: "https://puputong.huijipin.cn/uploads/20220324/62c9f56915adf7a7fd8281f6ae433c34.png",
						type: 3
					},
					{
						name: '停车位',
						img: "https://puputong.huijipin.cn/uploads/20220324/5eb8fe7bcebbf800761a4aa6ac705d95.png",
						type: 4
					},
					{
						name: '天然气',
						img: "https://puputong.huijipin.cn/uploads/20220324/ba73f35b1affc077443e9bde3ce82796.png",
						type: 5
					},
					{
						name: '网络',
						img: "https://puputong.huijipin.cn/uploads/20220324/9c8d55b7a3a55305a12e2a7eefd43726.png",
						type: 6
					},
					{
						name: '暖气',
						img: "https://puputong.huijipin.cn/uploads/20220324/ae80b3e8b0b6f8df9e37d019c2439dff.png",
						type: 7
					},
					{
						name: '扶梯',
						img: "https://puputong.huijipin.cn/uploads/20220324/bfd76739178b757fe011349a9548c5e0.png",
						type: 8
					},
					{
						name: '上水',
						img: "https://puputong.huijipin.cn/uploads/20220324/6195ea4029aa56b212562d9cba1fc77f.png",
						type: 9
					},
					{
						name: '下水',
						img: "https://puputong.huijipin.cn/uploads/20220324/644354749846003352b9b495d1288310.png",
						type: 10
					},
					{
						name: '排烟',
						img: "https://puputong.huijipin.cn/uploads/20220324/12b76ecb2db0f5f99a2b3809a164af69.png",
						type: 11
					},
					{
						name: '排污',
						img: "https://puputong.huijipin.cn/uploads/20220324/598c82c886ed36a48d2c6d299e5353e7.png",
						type: 12
					},

					{
						name: '管煤',
						img: "https://puputong.huijipin.cn/uploads/20220324/7aa5b60cd5838e8bb0c2bf07a4a11add.png",
						type: 13
					},
					{
						name: '380V',
						img: "https://puputong.huijipin.cn/uploads/20220324/df9fd9ac8aa2438ec9bfcaf1aabece4a.png",
						type: 14
					},
					{
						name: '可明火',
						img: "https://puputong.huijipin.cn/uploads/20220324/db9b7945cd5b5857fcf01d6fb630f2f2.png",
						type: 15
					},
					{
						name: '外摆区',
						img: "https://puputong.huijipin.cn/uploads/20220324/133613aae3bc4d82021daa9ff074f6df.png",
						type: 16
					},
				]
			};
		},
		onLoad(e) {
			this.info_id = e.info_id
		},
		onShow() {
			this.getinfo()
		},
		methods: {
			//收藏
			sc() {
				this.api('Info/collection', {
					info_id: this.info_id
				}).then(res => {
					this.$toast('操作成功')
					setTimeout(()=>{
						this.getinfo()
					},500)
				})
			},
			//拨打手机号
			phone(a) {
				this.api('Info/call', {
					info_id: this.info_id
				}).then(res => {
					uni.makePhoneCall({
						phoneNumber: res.data.mobile //仅为示例
					});
				})

			},
			show_(a) {
				this.show = a
			},
			//分享
			fx(a) {
				if (a == 3) {
					uni.setStorageSync('poast', this.info)
					// ?info=${JSON.stringify(encodeURIComponent(this.info))}
					uni.navigateTo({
						url: `/pages/index/poster/poster`
					})
				}
			},
			to_(a) {
				uni.navigateTo({
					url: `${a}`
				})
			},
			map() {
				uni.getLocation({
					type: 'wgs84', //返回可以用于uni.openLocation的经纬度
					success: (res) => {
						const latitude = res.latitude;
						const longitude = res.longitude;
						uni.openLocation({
							latitude: latitude,
							longitude: longitude,
							name: '测试测试测试',
							success: () => {
								console.log('success');
							}
						});
					}
				});
			},
			get(at) {
				let l = at.split(',')
				let data = []
				this.list.forEach(v => {
					l.forEach(a => {
						if (v.type == a) {
							data.push(v)
						}
					})
				})
				return data
			},
			getinfo() {
				this.api('Info/infoDetail', {
					info_id: this.info_id
				}).then(res => {
					this.info = res.data
					this.list = this.get(this.info.matchingdata)
				})
			}
		}
	}
</script>


<style lang="scss" scoped>
	.w {
		.carpw {
			.qxw {
				text-align: center;
				height: 80rpx;
				line-height: 80rpx;
			}

			uni-button:after {
				border: none
			}

			/deep/ button:after {
				border: none
			}

			.carp_1w {
				display: flex;
				justify-content: space-around;
				height: 180rpx;
				align-items: center;
				border-bottom: 1rpx solid #F5F5F5;

				.carp_1_1w {
					text-align: center;


					image {
						width: 52rpx;
						height: 52rpx;
					}

					text {
						display: block;
						font-size: 30rpx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #333333;
						opacity: 1;
					}
				}
			}
		}

		.bcw {
			position: fixed;
			left: 50%;
			margin-left: -140rpx;
			bottom: 20rpx;
			width: 280rpx;
			height: 88rpx;
			background: #FFD500;
			opacity: 1;
			border-radius: 44px;
			text-align: center;
			line-height: 88rpx;
			font-size: 30rpx;
			font-family: Source Han Sans CN;
			font-weight: 500;
			color: #703F00;
			opacity: 1;
		}
	}
</style>

<style lang="scss">
	.foot {
		position: fixed;
		background-color: white;
		bottom: 0;
		box-sizing: border-box;
		width: 100%;
		right: 0;
		height: 120rpx;
		box-sizing: border-box;
		left: 0;
		padding-left: 30rpx;
		align-items: center;
		padding-right: 30rpx;
		padding-top: 30rpx;
		display: flex;
		justify-content: space-between;
		padding-bottom: 20rpx;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);

		.foot_2 {
			width: 85%;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			background: #FF1B1B;
			border-radius: 40rpx;
			font-size: 30rpx;
			font-family: OPPOSans;
			font-weight: 500;
			color: #FFFFFF;
		}

		.foot_1 {
			text-align: center;

			image {
				width: 33rpx;
				height: 33rpx;
			}

			text {
				display: block;
				font-size: 24rpx;
				font-family: OPPOSans;
				font-weight: 400;
				color: #666666;

			}
		}
	}

	.caep4_1 {
		padding-left: 30rpx;
		height: 123rpx;
		background: #F4F5F7;
		font-size: 36rpx;
		display: flex;
		align-items: center;
		font-family: OPPOSans;
		font-weight: bold;
		color: #181818;
	}

	.caep3 {
		padding: 30rpx;
		// .carp_2{

		// }
		.carp_1 {
			font-size: 36rpx;
			font-family: OPPOSans;
			font-weight: bold;
			color: #181818;
		}

		.carp_2_1 {
			padding: 0rpx 30rpx 30rpx 30rpx;
			border-radius: 8rpx;
			box-sizing: border-box;
			background-color: #F4F5F7;
			display: block;
			display: flex;
			flex-wrap: wrap;
			margin-top: 30rpx;

			.carp_3_1 {
				width: 25%;
				text-align: center;
				margin-top: 35rpx;

				image {
					width: 40rpx;
					height: 41rpx;
				}

				text {
					margin-top: 20rpx;
					font-size: 22rpx;
					font-family: OPPOSans;
					font-weight: 400;
					color: #666666;
					display: block;
				}
			}

		}
	}

	.carp2 {
		display: flex;
		justify-content: space-between;
		padding: 30rpx;
		align-items: center;

		.img {
			width: 186rpx;
			height: 174rpx;

		}

		.carp2_1 {
			width: 60%;

			.carp2_1_1 {
				line-height: 60rpx;

				text:nth-of-type(1) {
					font-size: 28rpx;
					font-family: OPPOSans;
					font-weight: 500;
					color: #999999;
					margin-right: 20rpx;
				}

				text:nth-of-type(2) {
					font-size: 28rpx;
					font-family: OPPOSans;
					font-weight: 500;
					color: #181818;
				}
			}
		}
	}

	.carp {
		width: 91%;
		margin: auto;
		border-radius: 8rpx;
		background-color: #F4F5F7;
		height: 160rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.carp_1 {
			width: 35%;
			text-align: center;
		}

		.carp_1_2 {
			font-size: 24rpx;
			font-family: OPPOSans;
			font-weight: 500;
			color: #666666;
			margin-top: 10rpx;
		}

		.carp_1_1 {
			text-align: center;

			text:nth-of-type(1) {
				font-size: 36rpx;
				font-family: OPPOSans;
				font-weight: bold;
				color: #FF1B1B;
			}

			text:nth-of-type(2) {
				font-size: 24rpx;
				font-family: Adobe Heiti Std;
				font-weight: normal;
				color: #FF1B1B;
			}
		}
	}

	.title {
		padding: 30rpx;
		display: flex;

		.title_1 {
			font-size: 36rpx;
			font-family: OPPOSans;
			font-weight: bold;
			color: #181818;
		}

		.title_2 {
			width: 30%;
			text-align: right;

			image {
				width: 34rpx;
				height: 31rpx;
			}

			text {
				position: relative;
				left: 5rpx;
				font-size: 24rpx;
				font-family: OPPOSans;
				font-weight: 400;
				display: block;
			}
		}

	}
</style>
